﻿using SD.ContentSystem.Domain.Entities;
using SD.Infrastructure.RepositoryBase;
using System;
using System.Collections.Generic;

namespace SD.ContentSystem.Domain.IRepositories.Interfaces
{
    /// <summary>
    /// 文章仓储接口
    /// </summary>
    public interface IArticleRepository : IAggRootRepository<Article>
    {
        #region # 根据栏目获取文章列表 —— IEnumerable<Article> FindByChannel(string channelNo)
        /// <summary>
        /// 根据栏目获取文章列表
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>文章列表</returns>
        IEnumerable<Article> FindByChannel(string channelNo);
        #endregion

        #region # 分页获取文章列表 —— IEnumerable<Article> FindByPage(string keywords...
        /// <summary>
        /// 分页获取文章列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="rowCount">总记录条数</param>
        /// <param name="pageCount">总页数</param>
        /// <returns>文章列表</returns>
        IEnumerable<Article> FindByPage(string keywords, string channelNo, DateTime? startTime, DateTime? endTime, int pageIndex, int pageSize, out int rowCount, out int pageCount);
        #endregion

        #region # 获取文章索引 —— int GetRowIndex(string channelNo, Guid articleId)
        /// <summary>
        /// 获取文章索引
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>文章索引</returns>
        int GetRowIndex(string channelNo, Guid articleId);
        #endregion

        #region # 获取上一篇文章 —— Article GetPrevArticle(string channelNo, Guid articleId)
        /// <summary>
        /// 获取上一篇文章
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="articleId">文章Id</param>
        /// <returns>上一篇文章</returns>
        Article GetPrevArticle(string channelNo, Guid articleId);
        #endregion

        #region # 获取下一篇文章 —— Article GetNextArticle(string channelNo, Guid articleId)
        /// <summary>
        /// 获取下一篇文章
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="articleId">文章Id</param>
        /// <returns>下一篇文章</returns>
        Article GetNextArticle(string channelNo, Guid articleId);
        #endregion

        #region # 获取给定数量的文章列表 —— IEnumerable<Article> Find(string channelNo...
        /// <summary>
        /// 获取给定数量的文章列表
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="takeCount">提取数量</param>
        /// <returns>文章列表</returns>
        IEnumerable<Article> Find(string channelNo, int takeCount);
        #endregion

        #region # 是否存在文章 —— bool ExistsByChannel(string channelNo)
        /// <summary>
        /// 是否存在文章
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>是否存在</returns>
        bool ExistsByChannel(string channelNo);
        #endregion

        #region # 根据栏目获取文章记录数 —— int Count(string channelNo)
        /// <summary>
        /// 根据栏目获取文章记录数
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>记录数</returns>
        int Count(string channelNo);
        #endregion
    }
}
